]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ci: Make sure to always clear meson-install checkout dir
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 21 Mar 2023 00:00:07 +0000 (01:00 +0100)
committerMarge Bot <marge-bot@gnome.org>
Thu, 20 Apr 2023 15:59:56 +0000 (15:59 +0000)
We currently remove the directory at the end of the script, but
that code is only reached when all previous operations were
successful.

Address this by first using an absolute directory path in /tmp
instead of a "random" location based on the CWD, then set a trap
to remove it on exit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2712>

.gitlab-ci/install-meson-project.sh

index df188673ce89bbba07f6e55f592c78298383669f..fbb62b9d05db16289b6bc3ad33bf61cd3e679a35 100755 (executable)
@@ -31,14 +31,13 @@ COMMIT="$2"
 SUBDIR="$3"
 PREPARE="$4"
 
-REPO_DIR="$(basename ${REPO_URL%.git})"
+CHECKOUT_DIR=$(mktemp --directory)
+trap "rm -rf $CHECKOUT_DIR" EXIT
 
-git clone --depth 1 "$REPO_URL" -b "$COMMIT"
-pushd "$REPO_DIR"
-pushd "$SUBDIR"
+git clone --depth 1 "$REPO_URL" -b "$COMMIT" "$CHECKOUT_DIR"
+
+pushd "$CHECKOUT_DIR/$SUBDIR"
 sh -c "$PREPARE"
 meson setup --prefix=/usr _build "${MESON_OPTIONS[@]}"
 meson install -C _build
 popd
-popd
-rm -rf "$REPO_DIR"